'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable(
      'edu_areas',
      {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER.UNSIGNED,
        },
        pid: {
          allowNull: false,
          type: Sequelize.INTEGER.UNSIGNED,
          comment: '上级ID',
        },
        code: {
          allowNull: false,
          type: Sequelize.STRING(100),
          comment: '地区编码',
        },
        name: {
          allowNull: false,
          type: Sequelize.STRING(100),
          comment: '地区名称',
        },
        deleted_at: {
          allowNull: true,
          type: Sequelize.DATE,
          comment: 'null-表示未删除，有时间表示已删除即删除时间',
        },
        created_at: {
          allowNull: false,
          type: Sequelize.DATE,
        },
        updated_at: {
          allowNull: false,
          type: Sequelize.DATE,
        },
      },
      // {
      //   indexes: [
      //     {
      //       unique: 'false',
      //       fields: ['pid'],
      //     },
      //   ],
      // },
    );
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('edu_areas');
  },
};
